<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Stimulus360.Controllers.Projects.ProjectVolunteersViewModel>" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="Stimulus360.Services" %>
<%@ Import Namespace="Stimulus360.Controllers"%>
<%@ Import Namespace="Stimulus360.Models.Data" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<%RatingViewModel ratingViewModel = new RatingViewModel
  {
      Id = Model.ProjectSummary.ProjectId,
      AverageRating = Model.ProjectSummary.AverageRating,
      IsDisabled = true,
      IdeaId = Model.ProjectSummary.ProjectId
  };
%>
        <!-- Left Col Start -->
        <%Html.RenderPartial("ProjectDetailLeftNavigation", Model.ProjectSummary ); %>
        <!-- Left Col Ends -->
        <!-- Main Area Start -->
        <div class="mainInner colViewHdr">
            <div>
            <div class="projListItem floatLeft p10">
            <h1><%=Model.ProjectSummary.ProjectTitle %></h1>
            <div class="projStatusBar mt10">
                <div class="floatLeft pt02"><%=Model.ProjectSummary.SubmittedDate.ToString("D", CultureInfo.CreateSpecificCulture("en-US"))%> | by <%=Model.ProjectSummary.Submitter %></div>
                
                <div class="projStatus floatLeft pl10">
                  <div><%Html.RenderPartial("Rating", ratingViewModel); %></div>
                  <div class="separatorR">(<%=Model.ProjectSummary.UserRatingsCount %>)</div>
                  <div class="separatorR pt02">Favorites <%=Model.ProjectSummary.FavoritesCount%></div>
                  <div class="projStatusRpt">
                    <h4>Status: </h4>
                    <div> &nbsp;<%= Html.Image(Model.ProjectSummary.StatusString.ToLower() + ".png", "") %> </div>
                    <div class="statusWdth"><%=Model.ProjectSummary.StatusString %></div>
                  </div>
                    <br clear="all" />
                </div>
            </div>
      </div>
            
            <div class="floatRight pt10 mr10" id="joinDiv">
                <a href="/Projects/<%=Model.ProjectSummary.ProjectId%>/Volunteer" class="headerLabelBtn"><span> Join as a volunteer</span></a>
            </div>
            <br clear="all" />
            </div>
            
            <div id="feedbackListContainer">
                <%Html.RenderPartial("VolunteerList", Model.Volunteer); %>
            </div>
            <br clear="all" />
            <div class="pagerbg">
                <div id="pagerVolunteerList" class="pager">
                </div>
            </div>
            <!-- Main Area End -->
        </div>

<script type="text/javascript" language="javascript">
    $(document).ready(function() {

    var alreadyVolunteered = "<%=Model.AlreadyVolunteered%>"
        if (alreadyVolunteered.toString()== "True") { 
         
            $("#joinDiv").hide();
        }
             

        $("#volunteers").click();
        var totalPages_Project = "<%=Model.Volunteer.TotalPages %>";
        if (totalPages_Project == 1) {
            $(".pagerbg").hide();
        }
        var totalCount = "<%=Model.Volunteer.TotalCount %>";
        if (totalCount == 0) {
            $(".pagerbg").hide();
        }

        var currentPage = "<%=Model.Volunteer.PageIndex%>";

        $("#pagerVolunteerList").pager({ pagenumber: currentPage, pagecount: totalPages_Project, buttonClickCallback: PageClick_IdeaList });
    });

    PageClick_IdeaList = function(pageclickednuber) {
        var projectId = "<%=Model.ProjectSummary.ProjectId%>";
        var pageIndex = pageclickednuber;
        window.location = "/Projects/" + projectId.toString() + "/Volunteers/Page/" + pageIndex.toString();

    } 
</script>
</asp:Content>
